x86/vm_event: allow overwriting Xen's i-cache used for emulation
authorTamas K Lengyel <tamas.lengyel@zentific.com>
Mon, 26 Sep 2016 16:04:11 +0000 (18:04 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 26 Sep 2016 16:04:11 +0000 (18:04 +0200)
commit9bb1865cca15b28be5aa185cd865b95b49e7b303
tree8d8874810538a0e7b23fcbb6627c8f2ef8dcd798
parent89c423a170de2fef08445ea9151bcfa15c45b217
x86/vm_event: allow overwriting Xen's i-cache used for emulation

When emulating instructions Xen's emulator maintains a small i-cache fetched
from the guest memory. This patch extends the vm_event interface to allow
overwriting this i-cache via a buffer returned in the vm_event response.

When responding to a SOFTWARE_BREAKPOINT event (INT3) the monitor subscriber
normally has to remove the INT3 from memory - singlestep - place back INT3
to allow the guest to continue execution. This routine however is susceptible
to a race-condition on multi-vCPU guests. By allowing the subscriber to return
the i-cache to be used for emulation it can side-step the problem by returning
a clean buffer without the INT3 present.

As part of this patch we rename hvm_mem_access_emulate_one to
hvm_emulate_one_vm_event to better reflect that it is used in various vm_event
scenarios now, not just in response to mem_access events.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
xen/arch/x86/hvm/emulate.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/vm_event.c
xen/include/asm-x86/hvm/emulate.h
xen/include/asm-x86/vm_event.h
xen/include/public/vm_event.h